/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package at.ac.tuwien.ewa.g70.api;

import java.util.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.NoneScoped;

/**
 *
 * @author Amras
 */
@ManagedBean(name="User")
@NoneScoped
public class User {
    
    /*
     * the username of the user
     */
    private String login;

    /*
     * the user's password
     */
    private String password;

    /*
     * the first name of the user
     */
    private String firstname;

    /*
     * the last name of the user
     */
    private String lastname;

    /*
     * the birthdate of the user
     */
    private Date dateOfBirth;

    /*
     * the sex of the user
     */
    private String sex;

    /*
     * the heigth of the stack, e.g. 4 x 4 memory => sizeOfStack = 4
     */
    int sizeOfStack;

    /** Creates a new instance of User */
    public User() {
    }

    /** Creates a new instance of User */
    public User(User user) {

        if( user.getLogin() != null )
            this.login = new String(user.login);

        if( user.getPassword() != null )
            this.password = new String(user.password);

        if( user.getFirstname() != null )
            this.firstname = user.firstname;
        else
            this.firstname = null;

        if( user.getLastname() != null )
            this.lastname = user.lastname;
        else
            this.lastname = null;

        if( user.getDateOfBirth() != null )
            this.dateOfBirth = user.dateOfBirth;
        else
            this.dateOfBirth = null;

        if( user.getSex() != null )
            this.sex = user.sex;
        else
            this.sex = null;
        
        this.sizeOfStack = user.sizeOfStack;
    }


    public String getFirstname() {
        return firstname;
    }

    public String getLastname() {
        return lastname;
    }

    public String getPassword() {
        return password;
    }

    public String getLogin() {
        return login;
    }

    public Date getDateOfBirth() {
        return dateOfBirth;
    }

    public int getSizeOfStack() {
        return sizeOfStack;
    }

    public String getSex() {
        return sex;
    }

    public void setFirstname(String firstname) {
        this.firstname = firstname;
    }

    public void setLastname(String lastname) {
        this.lastname = lastname;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public void setDateOfBirth(Date dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public void setSizeOfStack(int sizeOfStack) {
        this.sizeOfStack = sizeOfStack;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }
    
}
